﻿namespace question7
{
    public abstract class Animal
    {
        public string Name { get; set; }
        public Animal(string name)
        {
            Name = name;
        }
        public abstract void Enjoy();
    }
    public class Cat : Animal
    {
        public string EyesColor { get; set; }
        public Cat(string name, string eyesColor) : base(name)
        {
            EyesColor = eyesColor;
        }

        public override void Enjoy()
        {
            Console.WriteLine($"{Name}（一只{EyesColor}眼睛的猫）开心地笑了笑");
        }
    }

    public class Dog : Animal
    {
        public string FurColor { get; set; }

        public Dog(string name, string furColor) : base(name)
        {
            FurColor = furColor;
        }
        public override void Enjoy()
        {
            Console.WriteLine($"{Name}（一只{FurColor}的狗）开心地叫了叫");
        }
    }
    public class Lady
    {
        public string Name { get; set; }
        public Animal Pet { get; set; }
        public Lady(string name, Animal pet)
        {
            Name = name;
            Pet = pet;
        }

        public void MyPetEnjoy()
        {
            Console.WriteLine($"{Name}的宠物开始高兴起来：");
            Pet.Enjoy();
        }
    }

    public class Program
    {
        public static void Main()
        {
            Cat cat = new Cat("咪咪", "蓝色");
            Lady msZhang = new Lady("张女士", cat);
            msZhang.MyPetEnjoy();
            Console.WriteLine("=============================================="); 
            Dog dog = new Dog("可乐", "金黄色");
            Lady msWang = new Lady("王女士", dog);
            msWang.MyPetEnjoy();
        }
    }

}
